package test;
import java.util.Scanner;

public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int num1 = sc.nextInt();
			int num2 = sc.nextInt();
			int count = 0;
			for(int i=num1; i<=num2; i++) {
				if(is_prime(i)) {
					count++;
				}
			}
			System.out.println(count);
		}
		
		public static boolean is_prime(int x) {
			if(x < 2) {
				return false;
			}else if(x == 2) {
				return true;
			}else if(x % 2 == 0) {
				return false;
			}
			for(int i=3; i<x-1;i++) {
				if(x % i == 0) {
					return false;
				}
			}
			return true;
		}
}

			